//
//  HealthViewController.m
//  App-MyFairldy
//
//  Created by 客官大大 on 15/5/23.
//  Copyright (c) 2015年 客官大大. All rights reserved.
//

#import "HealthViewController.h"

@interface HealthViewController ()

@end

@implementation HealthViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    UIImage *image = [UIImage imageNamed:@"heal.JPG"];
    UIImageView *imageview = [[UIImageView alloc] initWithImage:image];
    imageview.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height-0);
    imageview.alpha = 0.7;
    
    [self.view addSubview:imageview];
//    UILabel *l = [[UILabel alloc] initWithFrame:CGRectMake(108, 80, 150, 30)];
//    l.text = @"个人饮食热量评估";
//    [self.view addSubview:l];
//    
//    UIImageView *imagev = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"iconfont-shuidi-2"]];
//    imagev.frame = CGRectMake(60, 130, 50, 50);
//
//    
//    [self.view addSubview:imagev];
//    UILabel *lable = [[UILabel alloc] initWithFrame:CGRectMake(69, 110, 50, 30)];
//    lable.text = @"身高";
//    [self.view addSubview:lable];
//    UIImageView *imagev1 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"iconfont-shuidi-2"]];
//    imagev1.frame = CGRectMake(240, 130, 50, 50);
//    
//    
//    [self.view addSubview:imagev1];
//    UILabel *lable1 = [[UILabel alloc] initWithFrame:CGRectMake(248, 110, 50, 30)];
//    lable1.text = @"体重";
//    [self.view addSubview:lable1];
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(90, 150, 200, 180)];
    view.backgroundColor = [UIColor whiteColor];
    view.alpha = 0.7;
    view.layer.cornerRadius = 10;
    [self.view addSubview:view];
    
    
    
    
    
    
    UILabel *lable = [[UILabel alloc] init];
    lable.frame = CGRectMake(30, 12, 100, 30);
//    lable.layer.borderWidth = 1;
    lable.text = @"请输入身高";
    
//    lable.layer.backgroundColor = [UIColor blackColor].CGColor;
    [view addSubview:lable];
    
    UILabel *lable1 = [[UILabel alloc] init];
    lable1.frame = CGRectMake(30, 50, 100, 30);
    //    lable.layer.borderWidth = 1;
    lable1.text = @"请输入体重";

    //    lable.layer.backgroundColor = [UIColor blackColor].CGColor;
    [view addSubview:lable1];
    UILabel *lable3 = [[UILabel alloc] init];
    lable3.frame = CGRectMake(30, 90, 100, 30);
    lable3.text = @"请输入年龄";
    [view addSubview:lable3];
    self.field = [[UITextField alloc] initWithFrame:CGRectMake(120, 16, 50, 20)];
    _field.keyboardType=UIKeyboardTypeNumberPad;
    _field.layer.borderWidth = 1;
    _field.layer.cornerRadius = 6;
    _field.layer.borderColor = [UIColor blackColor].CGColor;
//    shen = [[NSString alloc] init];
//    shen = field.text;

    [view addSubview:_field];
    self.field2 = [[UITextField alloc] initWithFrame:CGRectMake(120, 95, 50, 20)];
    _field2.layer.borderWidth = 1;
    _field2.keyboardType=UIKeyboardTypeNumberPad;
    _field2.layer.cornerRadius = 6;
    _field2.layer.borderColor = [UIColor blackColor].CGColor;
    [view addSubview:_field2];
    self.field1 = [[UITextField alloc] initWithFrame:CGRectMake(120, 55, 50, 20)];
    _field1.layer.borderWidth = 1;
    _field1.keyboardType = UIKeyboardTypeNumberPad;
      _field1.layer.cornerRadius = 6;
    _field1.layer.borderColor = [UIColor blackColor].CGColor;
//    ti = [[NSString alloc] init];
//    ti = field1.text;
    [view addSubview:self.field1];
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
  [button setTitle:@"健康评估" forState:UIControlStateNormal];
    [button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    button.frame = CGRectMake(50, 130, 100, 30);
//    button.backgroundColor = [UIColor grayColor];
    button.layer.borderWidth = 1;
    button.layer.cornerRadius = 6;
    [button addTarget:self action:@selector(touchi) forControlEvents:UIControlEventTouchUpInside];
    
    [view addSubview:button];
    
}
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event//回收键盘，   触摸事件
{
//    [_field resignFirstResponder];
//    [_field1 resignFirstResponder];
    [self.view endEditing:YES];
    
    
    
    
}

-(void)touchi
{
    NSLog(@"%@",_field1.text);
    PingguViewController *pinggu = [[PingguViewController alloc] init];
    if (_field.text.length != 0&& _field1.text.length != 0) {
        
        pinggu.shengao = _field.text;
        pinggu.tizhong = _field1.text;
        pinggu.nianl = _field2.text;
    [self.navigationController pushViewController:pinggu animated:YES];
    }
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
